import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Element from 'element-ui'
import './permission'
import Cookies from 'js-cookie'
import './icons'
import 'normalize.css'
import axios from 'axios'
// import '@/assets/styles/test.scss'
// import '@/assets/iconfont/iconfont.css';
// import '@/utils/registerMicroApps'
import RegAppPlugin from '@/plugins/registerMicroApps'

// import { RegisterAppsData, buildEntry } from '@/plugins/registerMicroApps/regApp'

/** ElementUI component common definition */
declare class ElementUIComponent extends Vue {
  /** Install component into Vue */
  static install(vue: typeof Vue): void
}

declare class ElScrollbar extends ElementUIComponent {
  native: boolean
  wrapStyle: any
  wrapClass: any
  viewClass: any
  viewStyle: any
  noresize: boolean
  tag: string
}

declare module 'element-ui/types' {
  interface Scrollbar extends ElScrollbar {
  }

  export class Scrollbar extends ElScrollbar {
  }
}
Vue.config.productionTip = false

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

const regApi = process.env.NODE_ENV === 'development' ? '/conf/reg.json' : `//${process.env.CDN_HOST}/conf/reg.json`

// 从静态资源读取项目的配置文件
axios.get(regApi).then(res => {
  if (res.data) {
    Vue.use(RegAppPlugin, { regData: res.data })
    new Vue({
      router,
      store,
      render: h => h(App)
    }).$mount('#main')
  }
}).catch(err => {
  console.error(err)
})

console.info('qiankun(1.3.10)')
